<?php
include("../../inc/global.inc");
$url="zhaobiao.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<title>Admin</title>
<script type="text/javascript" src="../js/islogin.js" charset="gb2312"></script>
</head>
<body>
<center>
<?php
if($_GET['del_act']){
mysql_query("delete from news where id='".$_GET['del_id']."'");
echo "<script>alert('删除成功');location='$url';</script>";
}
?>
  <table width="85%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">三帝招标&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
  <table width="85%" border="0" cellspacing="0" cellpadding="0">
    <form method="get" action="<?=$url?>">
      <tr>
        <td height="35" style="line-height:22px;"><font color="blue">高级搜索：</font>标题&nbsp;
        <input name="search_name" type="text" size="25">&nbsp;&nbsp;&nbsp;&nbsp;<input name="submit" type="submit" value="搜索"></td>
      </tr>
      <input type="hidden" name="search_act" value="ok">
    </form>
  </table>
<?php 
if($_GET[search_name]){
$search_sql=" and news.news_title like '%$_GET[search_name]%'";
}
?>
  <table width="85%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000"> 
	<tr align='center'>
	<td width="47" height="30" bgcolor="#8DA8CF">编号</td>
	<td width="399" bgcolor="#8DA8CF">信息标题</td>
	<td width="100" bgcolor="#8DA8CF">用户名</td>
	<td width="102" bgcolor="#8DA8CF">地区</td>
	<td width="112" bgcolor="#8DA8CF">发布时间</td>
	<td width="67" bgcolor="#8DA8CF">状态</td>
	<td width="95" bgcolor="#8DA8CF"><a href="zhaobiao_modify.php?tj=ok"><font color="#0000FF">发布招标</font></a></td>
	</tr>
<?php
$sql="select member.m_user,news.id,news.type_id,news.news_title,news.pro_name,news.city_name,news.news_time,news.n_sh,news_type.type_name from news inner join news_type on (news.type_id=news_type.id) left join member on member.id=news.member_id where news_type.id=1 ".$search_sql." order by news.id desc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
?>
<tr align='center' bgcolor=<?=$color?>>
<td height="25" align="center"><?=$i?></td>
<td align="left" style="padding-left:5px;"><?=$row[news_title]?></td>
<td><?=$row['m_user']?></td>
<td align="center"><?=$row[pro_name]?><?php if($row[city_name]){echo "-$row[city_name]";}?></td>
<td align="center"><?=date("Y-m-d",strtotime($row[news_time]))?></td>
<td align="center"><?php if($row[n_sh]==1){?><font color="blue">正常</font><?php }else{?><font color="#FF0000">不显示</font><?php }?></td>
<td align="center"><a href="zhaobiao_modify.php?xg=ok&xg_id=<?=$row['id']?>&xg_page=<?=$thepage?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
</tr>
<?php
$i++;
}?>
<?php
$totalrecord=mysql_num_rows(mysql_query("select news.id,news.type_id,news.news_title,news.news_time,news.n_sh,news_type.type_name from news inner join news_type on (news.type_id=news_type.id) where news_type.id=1 ".$search_sql));
$totalpage=ceil($totalrecord/$maxpage);
?>
  <tr>
     <td height="31" colspan="9" align="center" bgcolor="#FFFFFF"><form method="get" action="<?=$url?>?search_type=<?=$_GET[search_type]?>">
<?php if($thepage>1){?>
   <a href="<?=$url?>?search_type=<?=$_GET[search_type]?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>&search_type=<?=$_GET[search_type]?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage&&$totalpage>1){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>&search_type=<?=$_GET[search_type]?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>&search_type=<?=$_GET[search_type]?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></form></td>
  </tr>
</table>
</center>
</BODY>
</HTML>

<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('请输入数字'); 
  document.getElementById(obj).value =""; 
} 
} 
</script>
